{% extends "base/admin.html" %}

{% block title %}仪表盘{% endblock %}

{% block content %}
        {% set config = g.api.get_sys_config().data %}
        {% set statistics = g.api.blog_get_statistics() %}
        <div class="row">
            <div class="col-md-12">
                <div class="row">
                    <!--综合信息-->
                    <div class="col-md-4">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <h5>综合信息一览表</h5>
                            </div>
                            <div class="ibox-content no-padding">
                                <ul class="list-group">
                                    <li class="list-group-item">
                                        <span class="badge badge-primary">{{ g.api.user_get_list(True).data|length }}</span>用户数量
                                    </li>
                                    <li class="list-group-item ">
                                        <span class="badge badge-info">{{ statistics.ArticleTotal }}</span> 文章数量
                                    </li>
                                    <li class="list-group-item">
                                        <span class="badge badge-default">{{ g.api.get_sys_friendlink().data|length }}</span> 友链数量
                                    </li>
                                    <li class="list-group-item">
                                        <span class="badge badge-warning">{{ g.api.user_get_authors().data|length }}</span> 作者数量
                                    </li>
                                    <li class="list-group-item">
                                        <span class="badge badge-success">{{ g.api.user_get_admins().data|length }}</span> 管理员数量
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <!--地址联系-->
                    <div class="col-md-4">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <h5>关于本站联系信息</h5>
                            </div>
                            <div class="ibox-content">
                               <address>
                                <p class="text-success">
                                   <strong>{{ config.about_awi }}</strong><br />
                                </p>
                                {% if config.about_address %}
                                    <i class="fa fa-map-marker"></i>&nbsp;&nbsp;&nbsp;{{ config.about_address }}<br />
                                {% endif %}
                                {% if config.about_phone %}
                                    <i class="fa fa-mobile-phone"></i>&nbsp;&nbsp;&nbsp;{{ config.about_phone }}<br />
                                {% endif %}
                                {% if config.about_email %}
                                    <i class="fa fa-envelope"></i>&nbsp;&nbsp;<a href="mailto:{{ config.about_email }}">{{ config.about_email }}</a><br />
                                {% endif %}
                                {% if config.about_ww %}
                                    <i class="fa fa-comments"></i>&nbsp;&nbsp;{{ config.about_ww }}<br />
                                {% endif %}
                                </address>                               
                            </div>
                        </div>
                    </div>
                    <!--置顶文章-->
                    <div class="col-md-4">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <h5>置顶文章列表</h5>
                            </div>
                            <div class="ibox-content">
                                <ol>
                                {% for blog in g.api.blog_get_top_data().data %}
                                    <li><a href="{{ url_for('front.blogShow', bid=blog.id) }}"><p class="text-danger">{{ blog.title }}</p></a></li>
                                {% endfor %}
                                </ol>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <!--分类-->
                    <div class="col-sm-4">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <h5>分类目录<span class="badge badge-danger">{{ statistics.CatalogTotal }}</span></h5>
                            </div>
                            <div class="ibox-content">
                                <div class="row clearfix">
                                    <ul>
                                    {% for catalog in g.api.blog_get_catalog_list().data %}
                                        <li><a href="{{ url_for('front.blogResource', resource_type='catalog', resource_data=catalog) }}">{{ catalog }}</a></li>
                                    {% endfor %}
                                        <li><a href="{{ url_for('front.blogResource', resource_type='sources', resource_data=1) }}">原创</a></li>
                                        <li><a href="{{ url_for('front.blogResource', resource_type='sources', resource_data=2) }}">转载</a></li>
                                        <li><a href="{{ url_for('front.blogResource', resource_type='sources', resource_data=3) }}">翻译</a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--标签云-->
                    <div class="col-sm-4">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <h5>标签云<span class="badge badge-danger">{{ statistics.TagTotal }}</span></h5>
                            </div>
                            <div class="ibox-content">
                                <div class="row clearfix">
                                    <div class="col-md-12 column">
                                    {% for tag in g.api.blog_get_tags_list().data %}
                                        <a href="{{ url_for('front.blogResource', resource_type='tag', resource_data=tag) }}"><span class="label label-{{ ChoiceColor() }}">{{ tag }}<strong>&nbsp;{{ g.api.blog_get_tag_data(tag=tag).data|length }}</strong></span></a>
                                    {% endfor %}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--推荐文章-->
                    <div class="col-sm-4">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <h5>推荐文章列表</h5>
                            </div>
                            <div class="ibox-content">
                               <ol>
                               {% for blog in g.api.blog_get_recommend_data().data %}
                                   <li><a href="{{ url_for('front.blogShow', bid=blog.id) }}"><p class="text-warning">{{ blog.title }}</p></a></li>
                               {% endfor %}
                               </ol>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
{% endblock %}
